# -*- coding: utf-8 -*-

"""
@author: atao
@Remark: 设备类别管理
"""

from dvadmin.system.models import DeviceTypes
from dvadmin.utils.serializers import CustomModelSerializer
from dvadmin.utils.viewset import CustomModelViewSet


class DeviceTypesSerializer(CustomModelSerializer):
    """
    序列化器
    """

    class Meta:
        model = DeviceTypes
        fields = "__all__"
        read_only_fields = ["id"]


class DeviceTypesCreateUpdateSerializer(CustomModelSerializer):
    """
    创建/更新时的列化器
    """

    class Meta:
        model = DeviceTypes
        fields = '__all__'


class DeviceTypesViewSet(CustomModelViewSet):
    """
    设备类别接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = DeviceTypes.objects.order_by('-create_datetime')
    serializer_class = DeviceTypesSerializer
    # filter_fields = ['creator_id']

    # permission_classes = []

